package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.House;
import com.ruoyi.system.mapper.HouseMapper;
import com.ruoyi.system.service.IHouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 房源Service业务层处理
 * 
 * @author ...
 * @date 2022-03-18
 */
@Service
public class HouseServiceImpl implements IHouseService 
{
    @Autowired
    private HouseMapper houseMapper;

    /**
     * 查询房源
     * 
     * @param id 房源主键
     * @return 房源
     */
    @Override
    public House selectHouseById(Integer id)
    {
        return houseMapper.selectHouseById(id);
    }

    /**
     * 查询房源列表
     * 
     * @param house 房源
     * @return 房源
     */
    @Override
    public List<House> selectHouseList(House house)
    {
        return houseMapper.selectHouseList(house);
    }

    /**
     * 新增房源
     * 
     * @param house 房源
     * @return 结果
     */
    @Override
    public int insertHouse(House house)
    {
        house.setCreateTime(DateUtils.getNowDate());
        return houseMapper.insertHouse(house);
    }

    /**
     * 修改房源
     * 
     * @param house 房源
     * @return 结果
     */
    @Override
    public int updateHouse(House house)
    {
        house.setUpdateTime(DateUtils.getNowDate());
        return houseMapper.updateHouse(house);
    }

    /**
     * 批量删除房源
     * 
     * @param ids 需要删除的房源主键
     * @return 结果
     */
    @Override
    public int deleteHouseByIds(Integer[] ids)
    {
        return houseMapper.deleteHouseByIds(ids);
    }

    /**
     * 删除房源信息
     * 
     * @param id 房源主键
     * @return 结果
     */
    @Override
    public int deleteHouseById(Integer id)
    {
        return houseMapper.deleteHouseById(id);
    }
}
